﻿using System.Collections.Generic;
using System.Web.Mvc;
using NStore.Domain.Violations;

namespace NStore.Web.Helpers
{
    public static class ControllerHelper
    {
        public static void AddRuleViolations(this ModelStateDictionary modelState, IEnumerable<RuleViolation> errors)
        {
            foreach (RuleViolation error in errors)
                modelState.AddModelError(error.PropertyName, error.ErrorMessage);
        }
    }
}
